from pydantic import BaseModel
from typing import Optional
from datetime import datetime

class HomepageBase(BaseModel):
    title: str
    content: Optional[str] = None
    is_published: bool = False
    is_active: bool = True

class HomepageCreate(HomepageBase):
    pass

class HomepageUpdate(BaseModel):
    title: Optional[str] = None
    content: Optional[str] = None
    version: Optional[int] = None
    is_published: Optional[bool] = None
    is_active: Optional[bool] = None

class Homepage(HomepageBase):
    id: int
    created_by: Optional[int] = None
    created_at: datetime
    updated_at: Optional[datetime] = None

    class Config:
        from_attributes = True 